package com.victor.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;

import com.victor.entity.Manager;

//@Component
@Mapper
public interface ManagerDao {//extends JpaRepository<Manager, Integer> {

	/**
	 * 验证是否存在该账号
	 * 
	 * @param m_account
	 * @return
	 */
	@Select({ "select * from manager where account=#{account}" })
	Manager loginexistmanager(@Param("account") String account);

	/**
	 * 登录方法
	 * 
	 * @param manager
	 * @return
	 */
	@Select({ "select * from manager where account=#{account} and password=#{password}" })
	Manager loginManager(Manager manager);

	/**
	 * 修改密码
	 * 
	 * @param manager
	 * @return
	 */
	@Update({ "update manager set password=#{password} where id=#{id}" })
	int updManagerPassword(Manager manager);

	/**
	 * 通过id查询原密码
	 * 
	 * @param id
	 * @return
	 */
	@Select({"select * from manager where id=#{id}"})
	Manager getManagerByid(@Param("id")Integer id);
}
